home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11945 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: news.magick.net!usenet
  2. From: Shawn Talbert <shawnt@src.usa.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Error Handling in C++
  5. Date: 17 Mar 1996 05:01:06 GMT
  6. Organization: SRC Vision
  7. Message-ID: <4ig6ai$puj@news.magick.net>
  8. References: <4ibj4h$l0i$1@mhafc.production.compuserve.com>
  9. NNTP-Posting-Host: ppp8.mfr.magick.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.2N (Windows; I; 32bit)
  14.  
  15. John Carlyle-Clarke <100615.2651@CompuServe.COM> wrote:
  16. >Can anyone offer any advice on the following problem?
  17. >
  18. >  Previously, when using procedural languages, I developed an 
  19. >What I need is for someone to suggest a good method for error 
  20. >handling without inbuilt exceptions that reflects the object 
  21. >oriented nature of the language, or a way of simulating 
  22. >exceptions like the MFC does.
  23. >
  24. >    John Carlyle-Clarke
  25.  
  26. I sympathize with you John; "real world" error handling is 
  27. woefully lacking in the texts I've seen...
  28.  
  29. If you are using Windows NT as your OS, look into the standard 
  30. exception handling built in to the OS. It is not based on C++ 
  31. exception handling, so it might be applicable to your design.
  32.  
  33. Another approach is to define an ERROR object in which error 
  34. status and reporting functionality can reside. If your 
  35. previous C style "error code" functions are converted to 
  36. returning an ERROR object instead of returning simple int's, 
  37. you get a similar programming style yet reap the benefits of 
  38. some OOD in error handling. In this manner, objects 
  39. communicate errors in a standard fashion, and you can enjoy 
  40. some code reuse by building generic error reporting functions 
  41. into the ERROR class (rather than handling errors from scratch 
  42. in each individual object in your system.)
  43.  
  44.  
  45.  
  46.